<!DOCTYPE html>
<html>
  <head>
    <title>房屋估价</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="keywords" content="keyword1,keyword2,keyword3">
    <meta name="description" content="this is my page">
    <meta name="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
  </head>
<link rel="stylesheet" href="./css/common.css">
<link rel="stylesheet" href="./css/sm.min.css">
<link rel="stylesheet" href="./css/sm-extend.min.css">
<script src="../js/jquery-2.1.1.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
<script src="../js/min/modernizr-custom-v2.7.1.min.js" type="text/javascript"></script>
<script src="../js/min/hammer-v2.0.3.min.js" type="text/javascript"></script>
<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
<script src="../js/min/modernizr-custom-v2.7.1.min.js" type="text/javascript"></script>
<script src="./js/zepto.js" type="text/javascript"></script>
<script src="./js/sm.js" type="text/javascript"></script>
<script src="../js/common.js"></script>
  <body>
  <header class="bar bar-nav">
<!--     <a class="button button-link button-nav pull-left" href="#" data-transition='slide-out' onclick="HomeDetail.goback()"> -->
<!--       <span class="icon icon-left" ></span> -->
<!--       返回 -->
<!--     </a> -->
    <h1 class="title">房屋估价</h1>
  </header>
<div class="content">
 <h3 style="padding: 5px;">查看我的房屋租金有多少？</h3>
  <h6  style="padding: 5px;font-size: 10px">请填写以下信息，系统将根据近期成交数据进行估价</h6>
  <div class="list-block" style="margin-top:0;">
    <ul>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">城市</div>
            <div class="item-input">
              <input type="text" placeholder="请输入城市" id="city">
            </div>
          </div>
        </div>
      </li>
     
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">小区名称</div>
            <div class="item-input">
             <input id="community_name" type="text" placeholder="请输入小区名称"/>
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">楼栋号</div>
            <div class="item-input">
              <input type="text" placeholder="请输入楼栋号" id="house_num">
            </div>
          </div>
        </div>
      </li>
       <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">居室数量</div>
            <div class="item-input">
              <input type="text" placeholder="例如：一居室" id="house_count">
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">房子总面积</div>
            <div class="item-input">
              <input type="text" placeholder="请输入房子总面积,单位：平米" id="houseSize">
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">房子朝向</div>
            <div class="item-input"> 
             <input type="text" id="towards" placeholder="请输入朝向"/>
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">装修程度</div>
            <div class="item-input">
              <input type="text" id="degree" placeholder="请输入装修程度" >
            </div>
          </div>
        </div>
      </li>
      <li>
        <div class="item-content">
          <div class="item-media"><i class="icon icon-form-name"></i></div>
          <div class="item-inner">
            <div class="item-title label">租赁时长</div>
            <div class="item-input">
              <input type="number" id="leaseLength" placeholder="请输入租赁时长,单位：月" >
            </div>
          </div>
        </div>
      </li>
      
    </ul>
  </div>

  <div class="content-block">
    <div class="row">
      <div class="col-50"><a href="javaScript:cancle()" class="button button-big button-fill button-light">取消</a></div>
      <div class="col-50" onclick="save()" id="submitBtn"><a href="#" class="button button-big button-fill button-info" >提交</a></div>
    </div>
  </div>
  
</div>
<script src="../js/common.js"></script>
<script type="text/javascript">
window.$$=window.Zepto = Zepto;
var nonce="";//生成签名的随机串
var signature="";//签名
var timestamp="";//时间戳
var title="欢迎使用蓝居";
var desc="这是蓝居管家首页，欢迎使用";
var sharLink="http://lanjushiye.com.cn/LanJuPublic/lanju/home.jsp";
var imgUrl="http://lanjushiye.com.cn/LanJuPublic/images/lanju.jpg";
$(document).ready(function(){  
// 	loadCommunity();
// 	loadFlag();
	  var url = encodeURI(location.href.split('#')[0]);
	  $.ajax({
	         url: "../weixinImpl/getEncryptJsapiTicket.spring?rn="+(new Date().getTime()),
	         type: "POST",
	         data:{"url":url},
	         dataType: "json",
	         success: function(data){
	        	 if(data != null){
	        		 nonce=data.nonce;
		             signature=data.signature;
		             timestamp=data.timestamp;
		             loadWx();
	        	 }
	             
	          },
	          error:function(err){
	            console.log('异常');
	          }
	        });
});

function loadWx(){
	  wx.config({
		    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
		    appId: 'wxb3b7beee9190b2ef', // 必填，公众号的唯一标识wxd894029b9bdb4b67
		    timestamp: timestamp, // 必填，生成签名的时间戳
		    nonceStr: nonce, // 必填，生成签名的随机串
		    signature: signature,// 必填，签名
		    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ'] // 必填，需要使用的JS接口列表
		});
	  wx.ready(function(){
		  //分享到朋友圈
		  wx.onMenuShareTimeline({
			    title: title, // 分享标题
			    link: sharLink, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			    imgUrl: imgUrl, // 分享图标
			    desc: desc, // 分享描述
			    success: function () {
			    // 用户确认分享后执行的回调函数
				},
			cancel: function () {
			    // 用户取消分享后执行的回调函数
		    }
		});
		  //分享到朋友
		  wx.onMenuShareAppMessage({
			  title: title, // 分享标题
			  desc: desc, // 分享描述
			  link: sharLink, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
			  imgUrl: imgUrl, // 分享图标
			  type: 'link', // 分享类型,music、video或link，不填默认为link
			  dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			  success: function () {
			  // 用户确认分享后执行的回调函数
			  },
			  cancel: function () {
			  // 用户取消分享后执行的回调函数
			  }
			  });
		  //分享到QQ
		  wx.onMenuShareQQ({
			  title: title, // 分享标题
			  desc: desc, // 分享描述
			  link: sharLink, // 分享链接
			  imgUrl: imgUrl, // 分享图标
			  success: function () {
			  // 用户确认分享后执行的回调函数
			  },
			  cancel: function () {
			  // 用户取消分享后执行的回调函数
			  }
			  });
	  });
	  
	  wx.error(function(res){
		
	  });
	  
}
function cancle(){
	history.go(-1);	
}
/** 保存 */
function save( ){
	
	$.ajax({
		type: "POST",
		dataType: "json",
		url: "../house/addHousePrice.do?rnd="+ Math.random(),
		data: {
	    city : $("#city").val().trim(),
	    community_name : $("#community_name").val().trim(),
		house_num : $("#house_num").val().trim(),
		house_count : $("#house_count").val().trim(),
		house_size : $("#houseSize").val().trim(),
		towards : $("#towards").val().trim(),
		degree : $("#degree").val().trim(),
		leaseLength:  $("#leaseLength").val().trim()
		},
		success: function(data){
			console.log(data)
			if( data.result){
				$$.alert("提交成功",function(){
					window.location.href="./liaojieLanJu.html?tab=tab2";
				});
			}else{
				$$.alert("提交失败");
			}
		},
		error: function(e) {
			$$.toast("请求出错");
		}
	});
}
function loadCommunity(){
	$.ajax({
		type: "POST",
		dataType: "json",
		url: "../community/getAreaCommunityList.do?rnd="+ Math.random(),
		data: {

		},
		success: function(data){
			var html="";
			console.log(data)
		if(data.rows!=null && data.rows.length>0){
			for(var i=0;i<data.rows.length;i++){
				html+="<option value="+data.rows[i].community_id+">"+data.rows[i].community_name;
				html+="</option>";				
			}
		$("#community_id").html(html);
		}
		},
		error: function(e) {
			$$.toast("请求出错");
		}
	});
}
function loadFlag   (){
	$.ajax({
		url: "../houseFlag/getAllFlagList",
		type: "POST",
       	dataType: 'json',
       	cache: false,
       	traditional: true,
        success: function (ret) {
        	console.log(ret);
			var houseLayoutHTML="";
			if(ret.rows!=null && ret.rows.length>0){
				for(var i=0;i<ret.rows.length;i++){
					var data=ret.rows[i];
					if(data.type==1){//布局
						houseLayoutHTML+="<option value="+data.flagName+">"+data.flagName+"</option>";
					}
				}
				$("#houseLayout").html(houseLayoutHTML);
				console.log(houseLayoutHTML);
			}
		}
	});
}
function cancle(){
	window.location.href="./liaojieLanJu.html?tab=tab2";
}
</script>
  </body>
</html>
